Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
@ampproject/toolbox-runtime-version
Advanced tools
Use it to query cdn.ampproject.org
for the current release or canary version of the AMP Runtime. Uses a stale-while-revalidate caching strategy to avoid network requests in the critical path.
You can use the API to re-write AMP runtime URLs to their versioned counter parts to improve browser caching, e.g. to replace:
https://cdn.ampproject.org/v0.css
with:
https://cdn.ampproject.org/rtv/001515617716922/v0.css
Install via:
npm install @ampproject/toolbox-runtime-version
Basic usage:
const runtimeVersion = require('@ampproject/toolbox-runtime-version');
// Release version
runtimeVersion.currentVersion().then(version => {
console.log(version);
});
// Canary version
runtimeVersion.currentVersion({canary: true}).then(version => {
console.log(version);
});
// Rewriting cache URLs
const ampRuntimeUrl = 'https://cdn.ampproject.org/v0.js';
const version = await runtimeVersion.currentVersion();
const versionedAmpRuntimeUrl = ampRuntimeUrl.replace(
'https://cdn.ampproject.org/',
'https://cdn.ampproject.org/rtv/' + version + '/'
);
console.log(versionedAmpRuntimeUrl);
FAQs
AMP Runtime versions
The npm package @ampproject/toolbox-runtime-version receives a total of 33,259 weekly downloads. As such, @ampproject/toolbox-runtime-version popularity was classified as popular.
We found that @ampproject/toolbox-runtime-version demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 16 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.